home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cream of the Crop 25
/
Cream of the Crop 25.iso
/
faq
/
wdj0597.zip
/
TOMLINSN.ZIP
/
TEST.C
< prev
Wrap
C/C++ Source or Header
|
1997-03-04
|
1KB
|
53 lines
#if 0
rem ** build.bat
rem ** uncomment the appropriate lines for your compiler **
rem **
rem build with Borland C++
rem bcc32 -w -DSTRICT test.c security.c
rem **
rem build with Visual C++
rem cl /W3 /DSTRICT test.c security.c advapi32.lib
#endif
#include <windows.h>
#include <stdio.h>
#include "security.h"
void main(void)
{
SYSTEMTIME st;
DWORD status;
HANDLE token;
if (OpenProcessToken(GetCurrentProcess(),TOKEN_QUERY,&token)) {
DumpAccessToken(token);
CloseHandle(token);
}
if (IsUserInGroup("Everyone")) {
printf("Current user is member of Everyone group\n");
}
if (IsUserInGroup("Administrators")) {
printf("Current user is member of Administrators group\n");
}
if (IsUserInGroup("Guests")) {
printf("Current user is member of Guests group\n");
}
GetSystemTime(&st);
status = EnablePrivilege(SE_SYSTEMTIME_NAME, TRUE);
if (status == ERROR_SUCCESS) {
st.wDay++;
SetSystemTime(&st);
} else {
if (status == ERROR_NOT_ALL_ASSIGNED) {
printf("Couldn't enable privilege; the privilege probably doesn't\n");
printf("exist in this access token.\n");
} else {
printf("Error %d\n", status);
}
}
} // main